<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>对象</title>
</head>
<body>
<script>
    var myNumber = 128
    document.write(myNumber+'十进制<br>')
    document.write(myNumber.toString(16)+'十六进制<br>')
    document.write(myNumber.toString(8)+'八进制<br>')
    document.write(myNumber.toString(2)+'二进制<br>')

    var infinityNum = 2
    while (infinityNum!=Infinity){
        infinityNum=infinityNum*infinityNum
        document.write(infinityNum+'无限大<br>')
    }
    var minusNum = -2/0
    document.write(minusNum+'负无限大<br>')

    if (isNaN(1000/"apple")){
        document.write("1000/apple不为数字<br>")
    }else {
        document.write("1000/apple为数字<br>")
    }

    if (isNaN(1000/"1000")){
        document.write("1000/1000不为数字<br>")
    }else {
        document.write("1000/1000为数字<br>")
    }

    var x = 123
    var y = new Number(123)
    document.write(typeof (x)+"<br>")
    document.write(typeof (y)+"<br>")
    //document.write("<p>"+x==y+"</p>>")

    document.write('It\'s called \'Johnny\'<br>')
    document.write("\\是转义字符<br>")
    var str = "Hello world,welcome to the universe."
    document.write(str.length+"<br>")
    document.write(str.indexOf("welcome")+"<br>")
    document.write(str.lastIndexOf("welcome")+"<br>")
    document.write(str.match("welcome")+"<br>")
    document.write(str.match("Welcome")+"<br>")
    document.write(str.replace("welcome","Welcome")+"<br>")
    document.write(str.toUpperCase()+"<br>")
    document.write(str.toLowerCase()+"<br>")
    var strArr = str.split(" ")
    for(var i=0;i<strArr.length;i++){
        document.write(strArr[i]+"<br>")
    }
    document.write( str.substr(2,3)+"<br>")
    document.write(str.substring(2,7)+"<br>")
    document.write(str.concat("It's called 'Johnny'")+"<br>")
    document.write(str.charAt(4)+"<br>")
    document.write(str.valueOf()+"<br>")
    document.write(str.search("llo")+"<br>")

    var d1 = new Date(2001,8,28,11,30,0)
    document.write(d1+"<br>")
    var d2 = new Date(86400000)
    document.write(d2+"<br>")
    var date = new Date()
    document.write(date+"<br>")
    date.setDate(date.getDate()+5)
    document.write(date+"<br>")
    if (d1>date){
        document.write("Today is before 2001 <br>")
    }else {
        document.write("Today is after 2001 <br>")
    }
    document.write(date.toUTCString()+"<br>")
    document.write("今天是"+date.getFullYear()+"年"+date.getMonth()+"月"+date.getDate()+"号"+" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds()+"   "+"星期"+date.getDay()+"<br>")
    document.write(date.toJSON()+"<br>")

    var myCars = new Array("Saab","Volvo","BMW")
    document.write(myCars.length+"<br>")
    if (myCars.indexOf("BMW")){
        document.write("有宝马<br>")
    }
    Array.prototype.ucase=function(){
        for(i=0;i<this.length;i++){
            this[i] = this[i].toUpperCase()
        }
    }
    myCars.ucase()
    document.write(myCars+"<br>")
    document.write(typeof (myCars.join())+"<br>")
    var newCars = myCars.concat(["Audi","Porsche","Bentley"])
    document.write(newCars.toString()+"<br>")
    function checkElement (element,index) {
        document.write(element+"  索引值"+index+"<br>")
        return true
    }
    myCars.every(checkElement)
    function checkS(element) {
        return element.match("S")
    }
    document.write(myCars.filter(checkS)+"<br>")
    myCars.pop()
    document.write(myCars+"<br>")
    myCars.push("BMW")
    document.write(myCars+"<br>")
    myCars.reverse()
    document.write(myCars+"<br>")
    myCars.shift()
    document.write(myCars+"<br>")
    document.write(myCars.slice(0,1)+"<br>")
    newCars.sort()
    document.write(newCars+"<br>")
    myCars.splice(0,0,"Saab")
    document.write(myCars+"<br>")
    myCars.unshift("Bugatti","Ferrari")
    document.write(myCars+"<br>")


    document.write("常量e"+Math.E+"<br>")
    document.write("2的自然对数"+Math.LN2+"<br>")
    document.write("10的自然对数"+Math.LN10+"<br>")
    document.write("2为底e的对数"+Math.LOG2E+"<br>")
    document.write("10为底的e的对数"+Math.LOG10E+"<br>")
    document.write("2的平方根的倒数"+Math.SQRT1_2+"<br>")
    document.write("2的平方根"+Math.SQRT2+"<br>")
    document.write("绝对值"+Math.abs(-2)+"<br>")
    document.write("反余弦"+Math.acos(0.5)+"<br>")
    document.write("反正弦"+Math.asin(0.5)+"<br>")
    document.write("反正切"+Math.atan(Math.PI/2)+"<br>")
    document.write("x轴到(x,y)的角度"+Math.atan2(1,1)+"<br>")
    document.write("四舍五入向上取值"+Math.ceil(0.2)+"<br>")
    document.write("正弦"+Math.sin(Math.PI/6)+"<br>")
    document.write("余弦"+Math.cos(Math.PI/3)+"<br>")
    document.write("e的指数"+Math.exp(100)+"<br>")
    document.write("四舍五入向下取值"+Math.floor(1.2)+"<br>")
    document.write("e为底数"+Math.log(3)+"<br>")
    document.write("最大值"+Math.max(1,2,3,4,5)+"<br>")
    document.write("最小值"+Math.min(1,2,3,4,5)+"<br>")
    document.write("次幂"+Math.pow(2,5)+"<br>")
    document.write("随机数"+Math.random()+"<br>")
    document.write("四舍五入"+Math.round(1.89)+"<br>")
    document.write("平方根"+Math.sqrt(4)+"<br>")


</script>
</body>
</html>